#include <time.h>

#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int str2int(const string &str)
{
	return atoi(str.c_str());
}
int str2int(const char *&str)
{
	return atoi(str);
}

string getDateNow()
{
	string ret;

	time_t time_now;
	struct tm *time_obj;
	time(&time_now);
	time_obj = localtime(&time_now);

	ret = to_string(time_obj->tm_year + 1900) + "-";
	ret += to_string(time_obj->tm_mon + 1) + "-";
	ret += to_string(time_obj->tm_mday);

	return ret;
}

string getTimeNow()
{
	string ret;

	time_t time_now;
	struct tm *time_obj;
	time(&time_now);
	time_obj = localtime(&time_now);

	ret = string(time_obj->tm_hour < 10 ? 1 : 0, '0') + to_string(time_obj->tm_hour) + ":";
	ret += string(time_obj->tm_min < 10 ? 1 : 0, '0') + to_string(time_obj->tm_min) + ":";
	ret += string(time_obj->tm_sec < 10 ? 1 : 0, '0') + to_string(time_obj->tm_sec);

	return ret;
}

string delBlank(const string &str)
{
	string blanks("\f\v\r\t\n ");
	string ret = str;
	if (str.empty())
		return ret;
	ret.erase(0, ret.find_first_not_of(blanks));
	ret.erase(ret.find_last_not_of(blanks) + 1);
	return ret;
}

string toLowerCase(const string &str)
{
	string ret = str;
	for (char &ch : ret)
		if (ch >= 'A' && ch <= 'Z')
			ch = ch - 'A' + 'a';
	return ret;
}